// import store from "@/store/index.js"

const  getOssImage=(url) =>{
  if (!url) {
    return require("@/assets/401_images/401.gif")
  } else {
    return process.env.VUE_APP_OSS_FILE_URL + url;
  }
}
// 获取缩略图
const  getOssImageThumbnail=(url)=> {
  if (!url) {
    return require("@/assets/401_images/401.gif")
  } else {
    return  process.env.VUE_APP_OSS_FILE_URL + url + '?x-oss-process=style/image-thumbnails' //OSS 缩略图规则
  }
}


const  getOssVideo=(url) =>{
  if (!url) {
    return undefined
  } else {
    return process.env.VUE_APP_OSS_FILE_URL + url;
  }
}

// 获取短视频封面
const  getOssVideoCover = (url)=> {
  if (!url) {
    return undefined
  } else {
    //去掉短视频.mp4后缀
    url = url.replace(".mp4", "_0.png")
    return 'https://' + process.env.VUE_APP_OSS_FILE_URL + '/' + url
  }
}

const  getOssVideoCoverThumbnail = (url)=> {
  if (!url) {
    return undefined
  } else {
    //去掉短视频.mp4后缀
    url = url.replace(".mp4", "_0.png")
    return 'https://' + process.env.VUE_APP_OSS_FILE_URL + '/' + url + '?imageMogr2/thumbnail/500x/rquality/70'
  }
}

export default {
  getOssImage,
  getOssImageThumbnail,
  getOssVideo,
  getOssVideoCover,
  getOssVideoCoverThumbnail
}

